//
//  ICConferenceButton.m
//  ICome
//
//  Created by zhangrongwu on 2017/7/8.
//  Copyright © 2017年 iCom. All rights reserved.
//

#import "ICConferenceButton.h"
#import "ICHeaderFile.h"

@interface ICConferenceButton ()

@property (nonatomic, strong) UIImageView *imageV;
@property (nonatomic, strong) UILabel *nameLabel;



@end

@implementation ICConferenceButton

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self addSubview:self.imageV];
        [self addSubview:self.nameLabel];
        
    }
    return self;
}

- (void)setMessageModel:(ICMessageModel *)messageModel
{
    NSString *key = messageModel.message.fileKey;
    NSDictionary *dict = [NSDictionary dictionaryWithJsonString:key];
    
    self.imageV.image = [UIImage imageNamedFromiComeSDKBundle:@"icon_video_meeting"];
    self.nameLabel.text   = dict[@"title"];
    
    self.imageV.frame = CGRectMake(15, 13, 50, 50);
    self.nameLabel.frame = CGRectMake(_imageV.right+10, _imageV.top+3, 150.0, 18.0);
//    self.nameLabel.centerY = self.imageV.centerY;
    [_nameLabel sizeToFit];
    
}


#pragma mark - Getter

- (UIImageView *)imageV
{
    if (!_imageV) {
        _imageV = [[UIImageView alloc] init];
    }
    return _imageV;
}

- (UILabel *)nameLabel
{
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc] init];
        _nameLabel.numberOfLines = 2;
        _nameLabel.font = [UIFont systemFontOfSize:16];
        _nameLabel.textColor = ICRGB(0x262626);
        _nameLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
    }
    return _nameLabel;
}

@end
